<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>[[${appName}]]</title>
    <meta name="renderer" content="webkit"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta
            name="viewport"
            content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0"
    />
    <link href="../js/layui/css/layui.css" rel="stylesheet">
    <link href="../style/admin.css" rel="stylesheet">
    <link href="../style/home.css" rel="stylesheet">
    <script>
        /^http(s*):\/\//.test(location.href) || alert('请通过 localhost 访问');

    </script>
    <style>
        .layui-btn-primary {
            color: #FFF;
            opacity: .8;
        }

        .layui-btn-primary:hover {
            color: #FFF;
            opacity: 1;
        }

        .layui-nav-dd {
            height: 1px;
            background-color: #E2E0E0D0;
            margin: 5px 10px;
        }


    </style>
</head>
<body class="layui-layout-body" id="TPMS_Home_Iframe">
<div id="TMS_App" style="visibility: hidden">
    <div class="layui-layout layui-layout-admin">
        <div class="layui-header">
            <div class="layui-logo" th:attr="lay-href=${'home/'+consolePage}" style="background-color: #0042ff">
                <img src="../images/logo.png">
            </div>

            <!-- 头部区域 -->
            <ul class="layui-nav layui-layout-right" lay-filter="layadmin-layout-right" style="padding-right: 10px;">
                <li class="layui-nav-item" lay-unselect>
                    <a href="javascript:" layadmin-event="refresh" title="刷新">
                        <i class="layui-icon layui-icon-refresh-3"></i>
                    </a>
                </li>
                <li class="layui-nav-item" lay-unselect>
                    <a lay-href="app/message/index.html" layadmin-event="message" lay-text="消息中心">
                        <i class="layui-icon layui-icon-notice"></i>
                        <!-- 如果有新消息，则显示小圆点 -->
                        <span class="layui-badge-dot"></span>
                    </a>
                </li>
                <li class="layui-nav-item layui-hide-xs" lay-unselect>
                    <a href="javascript:" layadmin-event="fullscreen">
                        <i class="layui-icon layui-icon-screen-full"></i>
                    </a>
                </li>
                <li class="layui-nav-item" lay-unselect>
                    <a href="javascript:">
                        <img src="./images/face/default_handsome.jpg" class="layui-nav-img"/>
                    </a>
                    <div class="layui-panel layui-nav-child" style="
                  width: 280px;
                  border: 1px solid #ebebeb;
                  padding: 0px;
                  top: 45px;
                ">
                        <div style="  background-color: #f4f6f7;  padding: 5px 5px;   line-height: 25px;">
                            <p th:text="${userName}" style="color: #000"></p>
                            <div class="userinfo-nav">
                                <ul>
                                    <li></li>
                                </ul>
                            </div>
                        </div>
                        <div style="padding-top: 10px">
                            <ul class="layui-menu" id="userInfo">
                                <li lay-options="{id: 'pwdModify'}" style="margin: 0 10px;">
                                    <div class="layui-menu-body-title">
                                        <i class="layui-icon layui-icon-key" style="padding-right: 5px"></i>修改密码
                                    </div>
                                </li>
                            </ul>
                        </div>
                        <hr/>
                        <div style="padding: 0px 10px 10px 10px">
                            <a href="account/logout"
                               class="layui-btn layui-btn-sm layui-btn-primary layui-btn-fluid layui-border-blue"
                               style="color: #000 !important;">退出登录</a>
                        </div>
                    </div>
                </li>
            </ul>
        </div>

        <!-- 侧边菜单 -->
        <div class="layui-side layui-side-menu">
            <div class="layui-side-scroll">
                <div style="height: 10px"></div>
                <ul class="layui-nav layui-nav-tree" lay-accordion id="LAY-system-side-menu"
                    lay-filter="layadmin-system-side-menu" style="padding:0 8px;">
                    <li data-name="home" class="layui-nav-item layui-this">
                        <a th:attr="lay-href=${'home/'+consolePage}" lay-tips="主页" lay-direction="2">
                            <i class="layui-icon layui-icon-home"></i>
                            <cite>主页</cite>
                        </a>
                    </li>
                    <li th:each="menu : ${userMenu}" th:attr="data-name=${menu.modulename}" class="layui-nav-item">
                        <th:block th:if="${menu.isChildren eq '0'}">
                            <a th:attr="lay-href=${menu.route}" th:attrappend="data-name=${menu.modulename}"
                               lay-tips=[[${menu.title}]] lay-direction="2">
                                <i th:class="${menu.imgidx!=null} ? 'layui-icon '+${menu.imgidx}"></i>
                                <cite>[[${menu.title}]]</cite>
                            </a>
                        </th:block>

                        <th:block th:if="${menu.isChildren eq '1'}">
                            <a href="javascript:" th:attr="lay-tips=${menu.title}" lay-direction="2">
                                <i th:class="${menu.imgidx!=null} ? 'layui-icon '+${menu.imgidx}"></i>
                                <cite>[[${menu.title}]]</cite>
                            </a>
                            <dl class="layui-nav-child">
                                <dd th:each="child:${menu.children}" th:attr="data-name=${child.modulename}">
                                    <a th:attr="lay-href=${child.route}" th:text="${child.title}"></a>
                                    <div th:if="${child.isnav=='1'}" class="layui-nav-dd"></div>
                                </dd>
                            </dl>
                        </th:block>
                    </li>
                </ul>
            </div>
        </div>

        <!-- 页面标签 -->
        <div class="layadmin-pagetabs" id="DMP_app_tabs">
            <div class="layui-icon layadmin-tabs-control layui-icon-prev" layadmin-event="leftPage"
                 style="    border-left: 1px solid #f5f5f5;"></div>
            <div class="layui-icon layadmin-tabs-control layui-icon-next" layadmin-event="rightPage"></div>
            <div class="layui-icon layadmin-tabs-control layui-icon-down">
                <ul class="layui-nav layadmin-tabs-select" lay-filter="layadmin-pagetabs-nav">
                    <li class="layui-nav-item" lay-unselect>
                        <a href="javascript:"></a>
                        <dl class="layui-nav-child layui-anim-fadein">
                            <dd layadmin-event="closeThisTabs"><a href="javascript:">关闭当前标签页</a></dd>
                            <dd layadmin-event="closeOtherTabs"><a href="javascript:">关闭其它标签页</a></dd>
                            <dd layadmin-event="closeRightTabs"><a href="javascript:">关闭右侧标签页</a></dd>
                            <dd layadmin-event="closeAllTabs"><a href="javascript:">关闭全部标签页</a></dd>
                        </dl>
                    </li>
                </ul>
            </div>
            <div class="layui-tab" lay-unauto lay-allowClose="true" lay-filter="layadmin-layout-tabs">
                <ul class="layui-tab-title" id="DMP_app_tabsheader">
                    <li th:attr="lay-id=${'home/'+consolePage}" lay-attr="${'home/'+consolePage}" class="layui-this"><i
                            class="layui-icon layui-icon-home"></i></li>
                </ul>
            </div>
        </div>


        <!-- 主体内容 -->
        <div class="layui-body" id="DMP_app_body">
            <div class="layadmin-tabsbody-item layui-show">
                <iframe th:attr="src=${'home/'+consolePage}" frameborder="0" class="layadmin-iframe"></iframe>
            </div>
            <div class="layui-footer">
                Copyright © 2025 TUOCENT Powered By DagV2
            </div>
        </div>

        <!-- 辅助元素，一般用于移动设备下遮罩 -->
        <div class="layadmin-body-shade" layadmin-event="shade"></div>
    </div>
</div>

<script src="../js/layui/layui.js"></script>
<script>
    layui.config({
        base: '../js/layui/' // 静态资源所在路径
    }).use(['index', 'dropdown'], function () {
        var dropdown = layui.dropdown;
        var $ = layui.$;

        dropdown.on('click(userInfo)', function (options) {
            var othis = $(this); //当前菜单列表的 DOM 对象
            othis.removeClass("layui-menu-item-checked");
            if (options.id == 'pwdModify') {
                pwdModify();
            }
        });


        function pwdModify() {
            top.layer.open({
                type: 2,
                title: '修改密码',
                content: './account/passwordModify',
                area: ['500px', '310px'],
                shadeClose: false,
                resize: false,
                btn: [
                    '<i class="layui-icon">&#xe605;</i> 确定',
                    '<i class="layui-icon">&#x1006;</i> 取消',
                ],
                yes: function (index, layero) {
                    var body = layer.getChildFrame('body', index);
                    var iframeWin = layero.find('iframe')[0];
                    if (iframeWin.contentWindow.Buttun_Submit()) {

                    }
                },
                btn2: function (index, layero) {
                    layer.close(index); //如果设定了yes回调，需进行手工关闭
                },
            });
        }

    });


    window.addEventListener('message', function (e) {
        var value = e.data;
        var iframe = admin.tabsBody(admin.tabsPage.index).find(".layadmin-iframe")[0];
        iframe.contentWindow.postMessage(value, "*");
    }, false);
</script>
</body>

</html>
